
/////////////////////

function Action($name$)
{
	this.$name$ = $name$;
}

////////////////////


var Rpc = {};

Rpc.call = function(action, callback, error)
{
	var aaa = action.$name$;
	delete action.$name$;
	
	var callback2 = function(result)
	{
		if (result.error)
		{
			if (error) error(result.error);
			else alert(result.error);
		}
		else if (callback)
		{
			callback(result.data);
		}
	}
	
	service.call({name:aaa, data:action}, callback2);
	
	action.$name$ = aaa;
}